package com.xiaouyudeguang.common.typeHandler;

import com.baomidou.mybatisplus.extension.handlers.AbstractJsonTypeHandler;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.core.type.TypeReference;
import com.xiaouyudeguang.common.utils.JsonObject;

import java.io.IOException;
import java.util.LinkedList;

public class LinkedTypeHandler extends AbstractJsonTypeHandler<LinkedList<String>> {

    @Override
    protected LinkedList<String> parse(String json) {
        try {
            return JsonObject.mapper().readValue(json, new TypeReference<LinkedList<String>>() {

            });
        } catch (IOException var3) {
            throw new RuntimeException(var3);
        }
    }

    @Override
    protected String toJson(LinkedList<String> obj) {
        try {
            return JsonObject.mapper().writeValueAsString(obj);
        } catch (JsonProcessingException var3) {
            throw new RuntimeException(var3);
        }
    }
}
